<?php
if(!defined('IN_CRONLITE'))exit();

$clientip=real_ip($conf['ip_type']?$conf['ip_type']:0);

if(isset($_COOKIE["admin_auth_token"])) {
	$token=authcode(daddslashes($_COOKIE['admin_auth_token']), 'DECODE', SYS_KEY);
	list($user, $sid, $expiretime) = explode("\t", $token);
	$session=md5($conf['admin_user'].$conf['admin_pwd'].$password_hash);
	if($session===$sid && $expiretime>TIMESTAMP) {
		$islogin=1;
	}else{
		unset($_COOKIE['admin_auth_token']);
	}
}
if(isset($_COOKIE["user_auth_token"])) {
	$token=authcode(daddslashes($_COOKIE['user_auth_token']), 'DECODE', SYS_KEY);
	list($uid, $sid, $expiretime) = explode("\t", $token);
	if($userrow = $DB->get_row("select * from authguao_user where uid='".intval($uid)."' limit 1")){
		$session=md5($userrow['user'].$userrow['pwd'].$password_hash);
		if($session===$sid && $userrow['active']==0 && $userrow['status']==1 && $expiretime>TIMESTAMP) {
			$islogin2=1;
		}else{
			unset($_COOKIE['user_auth_token']);
		}
	}
}
?>